<template>
	<view>
		<view class="data-list" v-for="item in list" :key="item.id">
			<view class="data-item">
				<view class="top u-flex">
					<view class="title u-flex-1">{{item.memo}}</view>
					<view class="money">{{item.money}}</view>
				</view>
				<view class="bot u-flex" style="margin-top: 16rpx;">
					<view class="time u-flex-1">
						{{ $u.timeFormat(item.createtime, ' yyyy.mm.dd hh:MM ') }}
					</view>
					<view class="productmoney"><text style="margin-right: 5rpx;">余额</text>{{item.after}}</view>
				</view>
			</view>
		</view>
		<!-- 缺省页 -->
			<shopro-empty v-if="isEmpty" :image="$IMG_URL + '/imgs/empty/empty_goods.png'" tipText="详见公众号社群端~"></shopro-empty>
	<!-- 加载更多 -->
		<u-loadmore v-show="!isEmpty" height="80rpx" :status="loadStatus" icon-type="flower" color="#ccc" />
	
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [
				],
				listParams: {
					page: 1
				},
				isEmpty: false,
				lastPage: 1,
				loadStatus: 'loadmore',
			};
		},
		onLoad() {
				this.getDataList();
		},
		// 触底加载更多
		onReachBottom() {
			if (this.listParams.page < this.lastPage) {
				this.listParams.page += 1;
				this.getDataList();
			}
		},
		methods: {
			// 数据列表
			getDataList() {
				let that = this;
				that.loadStatus = 'loading';
				that.$https('money.getMoneyList', {page:1}, '请求中...').then(res => {
					if (res.code === 1) {
						console.log('res', res)
						that.list==res.data.data
						that.isEmpty = !that.list.length;
						that.lastPage = res.data.last_page;
						that.loadStatus = that.page < res.data.last_page ? 'loadmore' : 'nomore';
						
					}
				});
			},
		}
	}
</script>
<style>
	page {
		background: #ffffff !important;
	}
</style>
<style lang="scss">
	.data-item {
		height: 120rpx;
		border-bottom: 1px solid #F3F3F3;
	}
	.data-list{
		padding: 32rpx;
	}
	.top{
		font-size: 32rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #010101;
	}
	
	.bot{
		font-size: 24rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #B5B5B5;
	}
	
</style>
